package com.wings4.number.utils;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * Created with IntelliJ IDEA.
 * User: Administrator
 * Date: 2/20/14
 * Time: 8:57 PM
 * To change this template use File | Settings | File Templates.
 */
public class Utility {

    public Date parseDate(String date, String format)
    {
        SimpleDateFormat formatter = new SimpleDateFormat(format);
        try{
            return formatter.parse(date);
        }catch (ParseException pe){
            pe.printStackTrace();
            return null;
        }

    }

    public int differenceBetweenTwoDate(Date startDate, Date endDate){
        return (int)(startDate.getTime() - endDate.getTime())/ (1000 * 60 * 60 * 24);
    }

}
